<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = 3;
        switch (num) {
            case 3: // 必须是全等的关系才能触发  ‘3’是不可以的
                alert("3")
                break; // break不写的话,下面的case没有满足条件也可以执行
            case 1:
                alert("1")
            default:
                break;
        }
    </script>
</body>

</html>